package com.client.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper2 extends SQLiteOpenHelper {
	private static final String NAME = "ClientTest.db";
	private static final int VERSION = 3;

	public DatabaseHelper2(Context context) {
		super(context, NAME, null, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {

		
		StringBuffer createBirdMessage= new StringBuffer();

		createBirdMessage.append("CREATE TABLE BIRDMESSAGE (");
		createBirdMessage.append("birdId varchar(100),");
		createBirdMessage.append("birdImage  varchar(100),");
		createBirdMessage.append("date  varchar(100),");
		createBirdMessage.append("birdName  varchar(100),");
		createBirdMessage.append("num  varchar(100),");
		
		
		
		createBirdMessage.append("kind  varchar(100),");
		createBirdMessage.append("healthNum  varchar(100),");
		createBirdMessage.append("sickNum  varchar(100),");
		createBirdMessage.append("sickImage  varchar(100),");
		createBirdMessage.append("sickDes  varchar(100),");
		
		
		createBirdMessage.append("deadNum  varchar(100),");
		createBirdMessage.append("deadImage  varchar(100),");
		createBirdMessage.append("deadDes  varchar(100),");
		createBirdMessage.append("collectLoaction  varchar(100),");
		createBirdMessage.append("place  varchar(100),");
		createBirdMessage.append("direct  varchar(100),");
		
		
		
		createBirdMessage.append("distance  varchar(100),");
		createBirdMessage.append("stayPlace  varchar(100),");
		createBirdMessage.append("longitude  varchar(100),");
		createBirdMessage.append("latitude  varchar(100),");
		createBirdMessage.append("uploaded  varchar(100),");
		createBirdMessage.append("pinyin  varchar(100),");
		createBirdMessage.append("clickNum  varchar(100),");
		createBirdMessage.append("lasttime  varchar(100),");
		createBirdMessage.append("localId  varchar(100),");
		createBirdMessage.append("status  varchar(100))");
		db.execSQL(createBirdMessage.toString());
		
		
		StringBuffer createUser= new StringBuffer();

		createUser.append("CREATE TABLE USER (");
		
		createUser.append("deviceName varchar(100),");
		createUser.append("deviceType  varchar(100),");
		createUser.append("deviceNum  varchar(100),");
		createUser.append("userName  varchar(100),");
		createUser.append("password  varchar(100),");
		createUser.append("unitName  varchar(100),");
		createUser.append("autologinStr  varchar(100),");
		createUser.append("rememberStr  varchar(100),");
		createUser.append("current varchar(100),");
		createUser.append("lasttime varchar(100),");//
		createUser.append("userId  varchar(100))");
		db.execSQL(createUser.toString());
		
		
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS BIRDMESSAGE");
		db.execSQL("DROP TABLE IF EXISTS USER");
		onCreate(db);
	}

}
